<template>
  <div class="mainCon">
    <topTitle :titleText="titleText" class="topConStyle"></topTitle>
    <div class="mainConHeader">
      <div class="mainConHeaderContent"></div>
      <el-tabs
        v-model="activeName"
        type="card"
        @tab-click="handleClick"
        class="commonTab"
      >
        <el-tab-pane
          :label="item.label"
          :name="item.id"
          v-for="item in list"
          :key="item.id"
        ></el-tab-pane>
      </el-tabs>
      <component v-bind:is="currentTabComponent"></component>
    </div>
  </div>
</template>

<script>
import caseRegistration from './caseRegistration'
import transferCase from './transferCase'
import emergencies from './emergencies'

export default {
  name: 'otherComplaintsTab',
  components: {
    caseRegistration,
    transferCase,
    emergencies,
  },
  data() {
    return {
      titleText: '其他投诉案件',
      activeName: '1',
      list: [
        {
          id: '1',
          label: '案件登记',
        },
        {
          id: '2',
          label: '省厅转办、督办案件',
        },
        {
          id: '3',
          label: '突发事件',
        },
      ],
      currentTabComponent: 'caseRegistration',
    }
  },
  created() {
    this.activeName = this.$route.query.activeName
      ? this.$route.query.activeName
      : '1'
    this.currentTabComponent = this.$route.query.currentTabComponent
      ? this.$route.query.currentTabComponent
      : 'caseRegistration'
  },
  methods: {
    //tabs栏切换
    handleClick(tab, event) {
      if (this.activeName == 1) {
        this.currentTabComponent = caseRegistration
      } else if (this.activeName == 2) {
        this.currentTabComponent = transferCase
      } else {
        this.currentTabComponent = emergencies
      }
    },
  },
}
</script>

<style scoped lang="less">
.mainCon {
  top: 132px;
  padding: 0;
  &Header {
    position: relative;
    &Content {
      position: absolute;
      left: 130px;
      z-index: 100;
      font-size: 12px;
      color: #666666;
    }
  }
}
</style>
